###----Jython Parent Library
###----Author: Alex Ramsey
###

import sys
sys.path.append("C:\\jython2.5.1\\Lib\\")

from CTU4 import *
from MBMT import *
import threading

this = threading.local()
this.lib = ""
this.p = ""

def setMain(parent, library):
	if (library == "CTU4"):
		this.lib = CTU4.funcs(parent)
	elif library == "MBMT":
		this.lib = MBMT.funcs(parent)
	#elif library == "XMI":
		#this.lib = XMI.funcs(parent)
	#elif library == "BCU":
		#this.lib = BCU.funcs(parent)
	#else:
		#do something
	
	this.p = parent

def execute(string=""):
	this.lib.execute(string)

def retrieveLine(string=""):
	return this.lib.retrieveLine(string)

def transmitAndWait(command="", string="", verbose=1):
	this.lib.transmit(command)
	this.lib.waitfor(string, timeout=10000)

def captureWaitfor(command="", start="", end="", timeout=10000, lineout=1000, verbose=1):
	return this.lib.captureWaitfor(command, start, end, timeout, lineout, verbose)
	
def capturePassed(string="", verbose=1):
	return(this.lib.capturePassed(string, verbose))

def transmit(command="", verbose=1):
	this.lib.transmit(command)
	
def simpleTransmit(command="", verbose=1):
	this.lib.simpleTransmit(command)
	
def waitfor(string="", timeout=10000, verbose=1):
	return this.lib.waitfor(string, timeout)

def pause(time=1000, verbose=1):
	return this.lib.pause(time)

def termmsg(message="", verbose=1):
	this.lib.termmsg(message)

def printHeader(string="", verbose=1):
	this.lib.printHeader(string)
	
def printFooter(string="", errorSummary=False, verbose=1):
	this.lib.printFooter(string, errorSummary)
	
def printMessage(string="", color=None, verbose=1):
	this.lib.printMessage(string, color, verbose)

def printErrorMessage(string="", verbose=1):
	this.lib.printErrorMessage(string, verbose)

def promptCli():
	return this.lib.promptCli()
	
def addError(string=""):
	this.lib.addError(string)
	